import React from "react"
import { Router, Switch, Route, Redirect } from "react-router-dom"
import PrivateRoute from "./components/PrivateRoute"
import Layout from "./pages/Layout"
import Login from "./pages/Login"
import NotFound from "./pages/NotFound"
import history from "./utils/history"

export default function App() {
  return (
    <Router history={history}>
      <div className="app">
        <Switch>
          <Redirect exact from="/" to="/home"></Redirect>
          <Route path="/login" component={Login}></Route>
          <PrivateRoute path="/home" component={Layout}></PrivateRoute>
          {/* 404 */}
          <Route component={NotFound}></Route>
        </Switch>
      </div>
    </Router>
  )
}
